home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13462 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  997 b 

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Q: free() function
  5. Date: 7 Apr 96 23:19:04 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.828919144@rscernix>
  8. References: <4k9ai7$rck@tibalt.supernet.ab.ca>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <4k9ai7$rck@tibalt.supernet.ab.ca> lts@news.supernet.ab.ca (Len Starrenburg) writes:
  13.  
  14. >When dynamically allocating memory for a series of strings and storing 
  15. >the addresses in a char pointer array, can all the allocated memory be 
  16. >freed simply using "free(array)" or does "free(array[x])" have to be 
  17. >executed for each pointer in the array.
  18.  
  19. The only way to free a memory block allocated via [cm]alloc or realloc
  20. is to pass the pointer returned by the respective function to free
  21. or realloc.
  22.  
  23. Dan
  24. --
  25. Dan Pop
  26. CERN, CN Division
  27. Email: danpop@mail.cern.ch 
  28. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  29.